package hlp

import (
	"github.com/gogo/protobuf/proto"
	protos "goim-pro/api/protos/salty"
	"goim-pro/pkg/logs"
	"goim-pro/pkg/utils"
)

var logger = logs.GetLogger("INFO")

func PrintResp(resp *protos.GrpcResp, pb proto.Message) {
	if err := utils.UnMarshalAnyToMessage(resp.GetData(), pb); err != nil {
		logger.Error("unmarshal failed: %v", err)
	}
	logger.Infof("[code]: %d", resp.GetCode())
	logger.Infof("[data]: %v", pb.String())
	logger.Infof("[message]: %s", resp.GetMessage())
}
